﻿using System.Windows.Forms;
public class Truck : Vehicle
{
    private float maxLoad; // 最大载重量
    private float oilPerKm; // 每公里耗油量
    // 重载SetVehicle方法（参数更多）
    public void SetVehicle(int wheels, float weight, float maxLoad, float oilPerKm)
    {
        this.wheels = wheels;
        this.weight = weight;
        this.maxLoad = maxLoad;
        this.oilPerKm = oilPerKm;
    }
    // 重写GetVehicle方法（new关键字）
    public new void GetVehicle()
    {
        MessageBox.Show($"车轮数:{wheels}\n车重量:{weight}吨\n载重量:{maxLoad}吨\n每公里耗油:{oilPerKm}L");
    }
    // 判断是否超载
    public bool Overload(float nowLoad)
    {
        return nowLoad > maxLoad;
    }
    // 计算总耗油量
    public float OilConsumption(float runKm)
    {
        return runKm * oilPerKm;
    }
}